<?php

namespace App\Validation;


use Phalcon\Validation\Validator\PresenceOf;
use Phalcon\Validation\Validator\StringLength;
use Phalcon\Validation\Validator\InclusionIn;

class Login3Validation extends BaseValidation
{
    public function initialize()
    {
        $this->add(
            "token",
            new PresenceOf(
                [
                    "message" => "The token is required",
                ]
            )
        );
		
        $this->add(
            "token",
            new StringLength(
				[
					"max" => 150,
					"min" => 32,
					"messageMaximum" => "The token Go beyond",
					"messageMinimum" => "The token Go beyond",
				]
            )
        );		
		
		$this->add(
			"open_id",
			new StringLength(
				[
					"max" => 64,
					"min" => 25,
					"messageMaximum" => "The open_id Go beyond",
					"messageMinimum" => "The open_id Go beyond",
				]
			)
		);
		
        $this->add(
            "origin",
            new InclusionIn(
                [
                    "message" => ":field Not in scope",
					"domain"=>["qq","weibo","weixin"]
                ]
            )
        );
		
		$this->add(
			"form",
			new InclusionIn(
				  [
					  "message" => ":field Not in scope",
					  "domain"=>["android","ios"]
				  ]
			)
		);
		
		
    }
}